﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using GSQ.BusinessEntities;
using GSQ.BusinessLogic;

namespace UIapp.Busquedas
{
    public partial class frmNc : Plantillas.frmFindPlantilla
    {
        public frmNc(List<NC> entities)
        {
            InitializeComponent();
            this.entityCollection = entities;
            this.bindingSource.DataSource = this.entityCollection.ToList();
        }

        #region Variables
        List<NC> entityCollection;
        #endregion

        #region Tratamiento de eventos
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (this.entityCollection.Count > 0)
            {
                if (((NC)this.radGridView.CurrentRow.DataBoundItem).M_PENDIENTE <= 0)
                {
                    Comun.ShowMessage("Este documento no tiene monto pendiente para utilizar", System.Windows.Forms.MessageBoxIcon.Information);
                    return;
                }
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }

        private void radGridView_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
        {
            this.btnAceptar.PerformClick();
        }
        #endregion
    }
}
